import request from '@/utils/request'

export function list(data) {
    data.json  = true
    let url = '/book/type/list'
    return request.post(url,data)
}

export function all() {
    let url = '/book/type/all'
    return request.get(url)
}

export function down(data) {
    data.json  = true
    let config = {
        responseType: 'arraybuffer',
    }
    let url =  '/book/type/down'
    return request.post(url,data,config)
}

export function info(id) {
    let url = '/book/type/info/' + id
    return request.get(url)
}

export function save(data) {
    data.json = true
    let url = '/book/type/save'
    return request.post(url,data)
}

export function update(data) {
    data.json = true
    let url = '/book/type/update'
    return request.post(url,data)
}

export function remove(data) {
    let url =  '/book/type/delete'
    return request.post(url,data)
}

export function options() {
    let url =  '/book/type/dmz/options'
    return request.get(url)
}

export function upload(file) {
    let url = '/book/type/upload';
    let forms = new FormData()
    forms.append("file",file)
    let config = {
        headers:{'Content-Type':'multipart/form-data'}
    }; //
    return request.post(url,forms,config)
}